<%@ page language="java" import="java.util.*"
	contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="com.model.Possession"%>
<%@ page import="com.control.PossessionControl"%>
<%@ page import="com.util.PageResultSet"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>查看寝室物品</title>
	</head>
	<body>
		<%
		    request.setCharacterEncoding("UTF-8");
		    String ToolBar = "";
		    int curPage = 1;
	    	ArrayList<Possession> list = new ArrayList<Possession>();
	    	PossessionControl pc = new PossessionControl();
	    	int stu_id = (Integer)session.getAttribute("user_id");
	    	list = pc.getStuPossession(stu_id);
	    	if(request.getParameter("cur_page")!= null) {
				curPage = Integer.parseInt(request.getParameter("cur_page")); 
			}
			PageResultSet p= new PageResultSet(list,curPage);
			ArrayList<Possession> nowlist = new ArrayList<Possession>();
			nowlist = (ArrayList<Possession>)p.getData();
		%>
		<table width="98%" border="0" align="center">
			<tr>
				<td></td>
			</tr>
			<tr>
				<td></td>
			</tr>
			<tr>
				<td>
					<fieldset>
						<legend>
							寝室物品列表
						</legend>
						<form action="resource_show.jsp" name="form1" method="post">
							<table width="70%" border="0" align="center" cellspacing="0"
								cellpadding="0">
								<tr>
									<td height="20"></td>
								</tr>
								<tr>
									<td>
										<table border="1" width="99%" align="center" cellpadding="0"
											cellspacing="1" class="resultTable">
											<tr>
												<td width="4%" height="25" align="center" bgcolor="#D9F0FF">
													物品名称
												</td>
												<td width="2%" height="25" align="center" bgcolor="#D9F0FF">
													数量
												</td>
								</tr>
								<%
										
										
										for(int i=0; i<nowlist.size(); i++) {
											Possession poss = nowlist.get(i);
									 %>
								 	<tr>
        								<td height="25" align="center"><%=poss.getRes_name()%></td>
 										<td height="25" align="center"><%=poss.getPoss_num()%></td>
 									</tr>
   									<%}
   										
										String fileName = "resourceInfo_show.jsp";
										ToolBar = p.getToolBar(fileName);
										//System.out.println(ToolBar);
									%>
							</table>
							<%=ToolBar %>
							
							</td>
							</tr>
							</table>
						</form>
					</fieldset>
				</td>
			</tr>
		</table>
	</body>
</html>
